<?php

class Reservations_PrintAction extends SrsReservationsBaseAction
{
	public function getCredentials()
	{
		return 'reservations.edit';
	}

	public function executeRead(AgaviRequestDataHolder $rd)
	{
		$reservation = Doctrine_Query::create()->from('Reservation r')->innerJoin('r.User')->innerJoin('r.Hall')->where('r.id=?', $rd->getParameter('id'))->fetchOne();

		if (!$reservation instanceof Reservation || !$reservation->isAllowedToBePrinted())
		{
			return $this->forward404();
   	}

		$this->setAttribute('reservation', $reservation);

  	return 'Success';
	}
}